@use "../abstracts/mixins";

$card-padding: 1rem;

.jenkins-card {
  display: flex;
  flex-direction: column;
  position: relative;
  border-radius: var(--form-input-border-radius);
  background: var(--card-background);

  &__title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 $card-padding;
    height: 2.875rem;
    flex-shrink: 0;
    font-size: var(--font-size-sm) !important;
    font-weight: var(--font-bold-weight);
    width: 100%;
    z-index: 2;
  }

  &__controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    margin-right: -0.4375rem;
  }

  &__content {
    display: flex;
    flex-direction: column;
    padding: 0 $card-padding $card-padding;
    overflow-y: auto;

    &:empty {
      display: none;
    }
  }

  &::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    border: var(--card-border-width) solid var(--card-border-color);
    z-index: 1;
    pointer-events: none;
  }

  .jenkins-card__reveal {
    @include mixins.item($border: false);

    --button-background: transparent;

    display: flex;
    align-items: center;
    justify-content: center;
    margin-block: -0.5rem;
    min-height: 0;
    padding: 0;
    width: 1.75rem;
    height: 1.75rem;
    color: var(--color);

    svg {
      width: 1rem;
      height: 1rem;
      color: var(--text-color-secondary);
    }

    &:hover,
    &:active,
    &:focus-visible,
    &[aria-expanded="true"] {
      svg {
        color: var(--text-color);
      }
    }
  }

  &__title-link {
    --inset: 0 -0.25rem 0 -0.5rem;

    gap: 0.25rem;
    width: unset !important;
    height: unset !important;
    margin-block: unset !important;
    line-height: 1.75rem;

    &::before,
    &::after {
      inset: var(--inset) !important;
    }

    svg {
      width: 0.875rem !important;
      height: 0.875rem !important;
      transition: var(--standard-transition);
    }

    &:hover,
    &:active,
    &:focus-visible {
      --inset: 0 -0.5rem;

      svg {
        translate: 0.125rem 0;
      }
    }
  }

  &__teaser {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    text-align: center;
    gap: 0.5rem;
    padding: 1rem;
    text-decoration: none !important;

    svg,
    img {
      width: 3rem;
      height: 3rem;
      margin-bottom: 0.5rem;

      * {
        stroke-width: 40px;
      }
    }

    div {
      font-weight: var(--font-bold-weight);
      color: var(--text-color-secondary);

      &:first-of-type {
        color: var(--text-color);
      }
    }
  }

  hr {
    align-self: stretch;
    border: none;
    border-top: var(--card-border-width) solid var(--text-color-secondary);
    opacity: 0.1;
    margin: 0;
  }
}

.jenkins-graph-card {
  background: white;
  padding: 0.5rem;
  border: var(--jenkins-border);
  border-radius: var(--form-input-border-radius);
  max-width: 100%;
}
